<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>tq.app.uuola.com</title>
        <script type="text/javascript" src="../../inc/ctx.jsp"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/txbase.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/json2.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/tpath.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/jstorage.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/index/js/tqcity.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://api.114la.com/ip/"  charset="gbk"></script>
        <style>
            body,div,b,table,tr,td{text-align:left;background:none;color:#000;font-size:12px; font-family: Verdana, Arial;padding:0;margin:0;}
            a{ text-decoration:none;color:#05A;}
            b.city{font-size:14px;color:#F07800;}
            img{border:none;}
        </style>
        <!--[if lte IE 6]>
        <style>img{ behavior: url(http://ss.uuola.cn/img/iepngfix.htc) }</style>
        <![endif]-->
        <script>
            var UUOLA={};
            UUOLA.TQ={
                TQCK:"tqck_uuola",
                getIdCity:function(d){
                    var a;
                    for(var b in CityArr){
                        a=CityArr[b];
                        if(a[0]==d){
                            return a[2];
                        }
                    }
                    return"101010100";
                },
                Reset:function(){
                    $("#setCityBox").show();
                    $("#weather").hide();
                },
                cp:function(d){
                    var b;
                    var a=[];
                    var e='<option value="@id">@C @city</option>';
                    for(var c in CityArr){
                        b=CityArr[c];
                        if(b[1]==d){
                            a.push(e.replace(/@id/,b[2])
                            .replace(/@C/,b[3])
                            .replace(/@city/,b[0]))
                        }
                    }
                    $("#w_city").html(a.join(""));
                },
                Save:function(){
                    var a=$("#w_city").val();
                    if(va.isnull(a)){
                        alert("没有选择城市.");
                        return
                    }
                    $("#setCityBox").hide();
                    UUOLA.TQ.Getdata(a,"weather");
                },
                Autoload:function(){
                    $.jStorage.set(UUOLA.TQ.TQCK,'');
                    $("#setCityBox").hide();
                    UUOLA.TQ.Render();
                },
                Getdata:function(a,b){
                   // var tqUrl=ut.enc("http://m.weather.com.cn/data/"+a+".html");
                   // $.ajax({type:"GET",cache:"true",url:def.ctx+"/index/proxy_get.shtm",data:"url="+tqUrl,dataType:"text",
                   $.ajax({type:"GET",cache:"true",url:"http://nap.uuola.com/tianqi/"+a,dataType:"jsonp",jsonp:"cb",
                        error:function(){
                            $("#"+b).html("网络读取失败...请<a href=\"javascript:;\" onclick=\"UUOLA.TQ.Render();\">重试</a>!");
                        },
                        success:function(c){
                            if(va.isnull(c)){
                                $("#"+b).html("网络读取失败...请<a href=\"javascript:;\" onclick=\"UUOLA.TQ.Render();\">重试</a>!");
                                return;
                            }
                            //var d=$.parseJSON(c);
                            var d=c;
                            $.jStorage.set(UUOLA.TQ.TQCK,a);
                            $("#"+b).html(TrimPath.processDOMTemplate("wtpl",d)).show();
                        }
                    });
                },
                Render:function(){
                    var a = 'weather';
                    if(va.isnull(ut.e(a))){return;}
                    $("#"+a).html("正在读取天气数据...").show();
                    var b=$.jStorage.get(UUOLA.TQ.TQCK);
                    if(va.isnull(b)){
                        UUOLA.TQ.Getdata(UUOLA.TQ.getIdCity(ILData[3]),a);
                    }else{
                        UUOLA.TQ.Getdata(b,a);
                    }
                }
            };
        </script>
    </head>
    <body>

        <div id="setCityBox" style="display:none;">
            请选择您要订制的城市：<br/>
            <select id="w_pro" onchange="UUOLA.TQ.cp(this.value)">
                <option value="">-选择省市-</option>
                <option value="109">B 北京</option>

                <option value="117">S 上海</option>
                <option value="110">T 天津</option>
                <option value="135">C 重庆</option>
                <option value="119">A 安徽</option>
                <option value="123">F 福建</option>
                <option value="127">G 广东</option>

                <option value="128">G 广西</option>
                <option value="137">G 贵州</option>
                <option value="131">G 甘肃</option>
                <option value="111">H 河北</option>
                <option value="124">H 河南</option>
                <option value="125">H 湖北</option>

                <option value="126">H 湖南</option>
                <option value="129">H 海南</option>
                <option value="116">H 黑龙江</option>
                <option value="122">J 江西</option>
                <option value="120">J 江苏</option>
                <option value="115">J 吉林</option>

                <option value="114">L 辽宁</option>
                <option value="132">N 宁夏</option>
                <option value="113">N 内蒙古</option>
                <option value="133">Q 青海</option>
                <option value="118">S 山东</option>
                <option value="112">S 山西</option>

                <option value="130">S 陕西</option>
                <option value="136">S 四川</option>
                <option value="139">X 西藏</option>
                <option value="134">X 新疆</option>
                <option value="138">Y 云南</option>
                <option value="121">Z 浙江</option>

                <option value="140">X 香港</option>
                <option value="141">A 澳门</option>
                <option value="142">T 台湾</option>
            </select>
            <select id="w_city" style="width:100px;"></select>
            <input type="button" value="确定" onclick="UUOLA.TQ.Save()" />
            <input type="button" value="返回" onclick="UUOLA.TQ.Autoload();"/>
        </div>
        <div id="weather"></div>
        <textarea id="wtpl" style="display:none">
<table width="390" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25">
    <a href="http://www.weather.com.cn/weather/@{weatherinfo.cityid}.shtml" target="_blank"><b class="city">@{weatherinfo.city}</b></a>
    <a onclick="UUOLA.TQ.Reset();" href="javascript:;" target="_self">[定制]</a>
    </td>
    <td rowspan="2">
    <a target="_blank" href="http://www.weather.com.cn/weather/@{weatherinfo.cityid}.shtml" id="t2">
        <img width="50" height="50" alt="" src="http://m.weather.com.cn/weather_img_png/@{weatherinfo.img2==99?weatherinfo.img1:weatherinfo.img2}.png" id="small1" title="今日天气指数 紫外线指数:@{weatherinfo.index_uv}  穿衣指数:@{weatherinfo.index_d}"></a>
</td>
    <td>今天 @{weatherinfo.weather1}</td>
    <td rowspan="2">
    <a target="_blank" href="http://www.weather.com.cn/weather/@{weatherinfo.cityid}.shtml" id="t5">
        <img width="50" height="50" alt="" src="http://m.weather.com.cn/weather_img_png/@{weatherinfo.img4==99?weatherinfo.img3:weatherinfo.img4}.png" id="small1" title="今日天气指数 紫外线指数:@{weatherinfo.index48_uv}  穿衣指数:@{weatherinfo.index48_d}"></a>
    </td>
    <td>明天 @{weatherinfo.weather2}</td>
  </tr>
  <tr>
    <td height="25"><a href="http://www.weather.com.cn/weather/@{weatherinfo.cityid}.shtml#7d" target="_blank">七天预报</a></td>
    <td>@{weatherinfo.temp1}</td>
    <td>@{weatherinfo.temp2}</td>
  </tr>
</table>
        </textarea>
        <script>
            ut.delay(function(){
                UUOLA.TQ.Render(); 
            });
        </script>
    </body>
</html>
